/*
 * @: 
 * @Version: 1.0
 * @Autor: ziwei
 * @Date: 2022-02-25 14:31:24
 * @LastEditors: ziwei
 * @LastEditTime: 2022-02-28 11:35:17
 */
const path = require('path')
const htmlWebpackPlugin = require('html-webpack-plugin')
const  AutoExternal = require('./plugins/auto-external-plugin')
// const DonePlugin = require('./plugins/done-plugin')
// const AssetPlugin = require('./plugins/assets-plugin')
// //存档插件，把所有的输出的文件变成一个压缩包，放到输出目录
// const ArchivePlugin  = require('./plugins/archive-plugin');
module.exports = {
  mode:'development',
  entry:'./src/index.js',
  entry:'./src/index.js',
  output:{
    filename:`[name].js`
  },
  //配置模块外链，远离不再打包对应jquery和odash模块，而是从window.jquery window._上进入此模块的内容
  /* externals:{
    'jquery':'jQuery',
    'lodash':'_'
  }, */
  plugins:[
    new htmlWebpackPlugin({
      template:'./src/index.html'
    }),
    new AutoExternal({
      jquery:{
        varName:'jQuery',
        url:'https://cdn.bootcss.com/jquery/3.1.0/jquery.js'
      },
      lodash:{
        varName:'_',
        url:'https://cdn.bootcss.com/ajax/libs/lodash.js/4.17.21/lodash.js'     
      }
    })
    // new DonePlugin(),
    // new AssetPlugin(),
    // new ArchivePlugin({
    //   filename:`[timestamp].zip`
    // })
  ]
}